package com.example.demo.demos.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.demos.web.domain.Classmate;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClassmateMapper {
    // 增加学生
    @Insert("INSERT INTO Classmate (xuehao, dorm, name, id) VALUES (#{xuehao}, #{dorm}, #{name}, #{id})")
    int insertClassmate(Classmate classmate);

    // 删除学生
    @Delete("DELETE FROM Classmate WHERE xuehao = #{xuehao}")
    int deleteClassmateByXuehao(int xuehao);

    // 修改学生
    @Update("UPDATE Classmate SET dorm = #{dorm}, name = #{name}, id = #{id} WHERE xuehao = #{xuehao}")
    int updateClassmate(Classmate classmate);

    // 查询学生
    @Select("SELECT * FROM Classmate WHERE xuehao = #{xuehao}")
    Classmate selectClassmateByXuehao(int xuehao);
}